package com.mingqijia.gassafety.console.controller;

import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.shared.dto.TaskTemplateListRespDTO;
import com.mingqijia.gassafety.webserver.request.TemplateListRequest;
import com.mingqijia.gassafety.webserver.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 消息模板，任务相关接口
 * @author: duanhongxiang
 * @Desc:
 * @create: 2024-10-18 14:20
 **/
@Slf4j
@Api(tags = "消息")
@RestController(value = "MessageController")
@RequestMapping("/business/v1/message")
public class MessageController {
    @Autowired
    MessageService messageService;

    @ApiOperation("模板列表")
    @PostMapping("/templateList")
    public CommonResponse<List<TaskTemplateListRespDTO>> getTemplateList(@RequestBody TemplateListRequest req){
        return CommonResponse.success(messageService.getTemplateListByCode(req));
    }
}
